Nested KVM
2013/10/22 |
Configure nested KVM. It's possible to install KVM and create virtual machines as nested KVM on KVM host.
|
|
[1] | The Kernel of CentOS 6 is 2.6.32 and it does not support Nested KVM, so it's necessarry to update to supported Kernel for Nested KVM first. |
[root@dlp ~]#
yum -y install centos-release-xen
[root@dlp ~]#
sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-Xen.repo
[root@dlp ~]#
yum --enablerepo=Xen4CentOS -y update kernel
[root@dlp ~]#
vi /boot/grub/grub.conf # add at the end of the line of kernel like follows kernel /vmlinuz-3.4.61-9.el6.centos.alt.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto console=ttyS0,115200n8 rd_LVM_LV=VolGroup/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM kvm-intel.nested=1
[root@dlp ~]#
# confirm status ( it's OK if it is "Y" ) [root@dlp ~]# cat /sys/module/kvm_intel/parameters/nested Y |
[2] | Make sure the CPU model on your computer. |
[root@dlp ~]# virsh capabilities | egrep "/model|/vendor" <model>SandyBridge</model> # CPU Model <vendor>Intel</vendor> # CPU Vendor <model>none</model> <model>dac</model> |
[3] | Edit the configuration of a virtual machine you'd like to nest like follows. It's OK to configure nested KVM and you can create virtual machines on the virtual machine nested. |
[root@dlp ~]#
virsh edit www # edit a virtual machine "www" # add following lines
<cpu mode='custom' match='exact'>
# CPU model <model fallback='allow'>SandyBridge</model> # CPU vendor <vendor>Intel</vendor> <feature policy='require' name='vmx'/> </cpu> |